<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:ss="http://schemas.Kherty.com/office/2007/spreadsheet"
  xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI"
  xmlns:oui="http://schemas.Kherty.com/office/2007"
  x:Class="OpenLS.Spreadsheet.UI.ResizeAdornerResources">
  <ResourceDictionary.MergedDictionaries>
    <oui:MenuResources/>
  </ResourceDictionary.MergedDictionaries>
  <Style TargetType='{x:Type Thumb}' x:Key='resizeThumb'>
    <Setter Property='Template'>
      <Setter.Value>
        <ControlTemplate TargetType='{x:Type Thumb}'>
          <Grid Background='Transparent' Cursor='SizeNWSE'>
            <Path Fill='#FFDDF0FF' Margin='2 2 0 0' Data='M0,0 L2,0 L 2,2 L 0,2 Z M 4,0 L6,0 L6,2 L4,2 Z  M0,4 L2,4 L2,6 L0,6 Z'/>
            <Path Fill='#FF7F7F7F' Margin='3 3 0 0' Data='M0,0 L2,0 L 2,2 L 0,2 Z M 4,0 L6,0 L6,2 L4,2 Z  M0,4 L2,4 L2,6 L0,6 Z'/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
    <Style.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property ='HorizontalAlignment' Value ='Center'/>
          <Condition Property ='VerticalAlignment' Value ='Top'/>
        </MultiTrigger.Conditions>
        <Setter Property ='Template'>
          <Setter.Value>
            <ControlTemplate TargetType='{x:Type Thumb}' >
              <Grid Background='Transparent' Cursor='SizeNS'>
                <Path Fill='#FFDDF0FF' Margin='0 1 0 0' Data='M0,0 L2,0 L 2,2 L 0,2 Z M 4,0 L6,0 L6,2 L4,2 Z  M 8,0 L10,0 L10,2 L8,2 Z  M 12,0 L14,0 L14,2 L12,2 Z'/>
                <Path Fill='#FF7F7F7F' Margin='-1 2 1 0' Data='M0,0 L2,0 L 2,2 L 0,2 Z M 4,0 L6,0 L6,2 L4,2 Z  M 8,0 L10,0 L10,2 L8,2 Z  M 12,0 L14,0 L14,2 L12,2 Z'/>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property ='HorizontalAlignment' Value ='Center'/>
          <Condition Property ='VerticalAlignment' Value ='Bottom'/>
        </MultiTrigger.Conditions>
        <Setter Property ='Template'>
          <Setter.Value>
            <ControlTemplate TargetType='{x:Type Thumb}' >
              <Grid Background='Transparent' Cursor='SizeNS'>
                <Path Fill='#FFDDF0FF' Margin='0 0 0 1' VerticalAlignment='Bottom' Data='M0,0 L2,0 L 2,2 L 0,2 Z M 4,0 L6,0 L6,2 L4,2 Z  M 8,0 L10,0 L10,2 L8,2 Z  M 12,0 L14,0 L14,2 L12,2 Z'/>
                <Path Fill='#FF7F7F7F' Margin='-1 0 1 2' VerticalAlignment='Bottom' Data='M0,0 L2,0 L 2,2 L 0,2 Z M 4,0 L6,0 L6,2 L4,2 Z  M 8,0 L10,0 L10,2 L8,2 Z  M 12,0 L14,0 L14,2 L12,2 Z'/>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property ='VerticalAlignment' Value ='Center'/>
          <Condition Property ='HorizontalAlignment' Value ='Left'/>
        </MultiTrigger.Conditions>
        <Setter Property ='Template'>
          <Setter.Value>
            <ControlTemplate TargetType='{x:Type Thumb}' >
              <Grid Background='Transparent' Cursor='SizeWE'>
                <Path Fill='#FFDDF0FF' Margin='1 0 0 0' HorizontalAlignment='Left' Data='M0,0 L2,0 L 2,2 L 0,2 Z M 0,4 L0,6 L2,6 L2,4 Z  M0,8 L0,10 L2,10 L2,8 Z  M0,12 L0,14 L2,14 L2,12 Z'/>
                <Path Fill='#FF7F7F7F' Margin='2 -1 0 1' HorizontalAlignment='Left' Data='M0,0 L2,0 L 2,2 L 0,2 Z M 0,4 L0,6 L2,6 L2,4 Z  M0,8 L0,10 L2,10 L2,8 Z  M0,12 L0,14 L2,14 L2,12 Z'/>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property ='VerticalAlignment' Value ='Center'/>
          <Condition Property ='HorizontalAlignment' Value ='Right'/>
        </MultiTrigger.Conditions>
        <Setter Property ='Template'>
          <Setter.Value>
            <ControlTemplate TargetType='{x:Type Thumb}' >
              <Grid Background='Transparent' Cursor='SizeWE'>
                <Path Fill='#FFDDF0FF' Margin='0 0 1 0' HorizontalAlignment='Right' Data='M0,0 L2,0 L 2,2 L 0,2 Z M 0,4 L0,6 L2,6 L2,4 Z  M0,8 L0,10 L2,10 L2,8 Z  M0,12 L0,14 L2,14 L2,12 Z'/>
                <Path Fill='#FF7F7F7F' Margin='0 1 2 -1' HorizontalAlignment='Right' Data='M0,0 L2,0 L 2,2 L 0,2 Z M 0,4 L0,6 L2,6 L2,4 Z  M0,8 L0,10 L2,10 L2,8 Z  M0,12 L0,14 L2,14 L2,12 Z'/>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property ='HorizontalAlignment' Value ='Right'/>
          <Condition Property ='VerticalAlignment' Value ='Top'/>
        </MultiTrigger.Conditions>
        <Setter Property ='Template'>
          <Setter.Value>
            <ControlTemplate TargetType='{x:Type Thumb}' >
              <Grid Background='Transparent' Cursor='SizeNESW'>
                <Path Fill='#FFDDF0FF' Margin='0 2 2 0' VerticalAlignment='{TemplateBinding VerticalAlignment}' HorizontalAlignment='{TemplateBinding HorizontalAlignment}' Data='M0,0 L2,0 L 2,2 L 0,2 Z M4,0 L6,0 L6,2 L4,2 Z  M4,4 L6,4 L6,6 L4,6 Z'/>
                <Path Fill='#FF7F7F7F' Margin='0 3 3 0' VerticalAlignment='{TemplateBinding VerticalAlignment}' HorizontalAlignment='{TemplateBinding HorizontalAlignment}' Data='M0,0 L2,0 L 2,2 L 0,2 Z M4,0 L6,0 L6,2 L4,2 Z  M4,4 L6,4 L6,6 L4,6 Z'/>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property ='HorizontalAlignment' Value ='Left'/>
          <Condition Property ='VerticalAlignment' Value ='Bottom'/>
        </MultiTrigger.Conditions>
        <Setter Property ='Template'>
          <Setter.Value>
            <ControlTemplate TargetType='{x:Type Thumb}' >
              <Grid Background='Transparent' Cursor='SizeNESW'>
                <Path Fill='#FFDDF0FF' Margin='2 0 0 2' VerticalAlignment='{TemplateBinding VerticalAlignment}' HorizontalAlignment='{TemplateBinding HorizontalAlignment}' Data='M0,0 L2,0 L 2,2 L 0,2 Z M0,4 L0,6 L2,6 L2,4 Z  M4,4 L6,4 L6,6 L4,6 Z'/>
                <Path Fill='#FF7F7F7F' Margin='3 0 0 3' VerticalAlignment='{TemplateBinding VerticalAlignment}' HorizontalAlignment='{TemplateBinding HorizontalAlignment}' Data='M0,0 L2,0 L 2,2 L 0,2 Z M0,4 L0,6 L2,6 L2,4 Z  M4,4 L6,4 L6,6 L4,6 Z'/>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property ='HorizontalAlignment' Value ='Right'/>
          <Condition Property ='VerticalAlignment' Value ='Bottom'/>
        </MultiTrigger.Conditions>
        <Setter Property ='Template'>
          <Setter.Value>
            <ControlTemplate TargetType='{x:Type Thumb}' >
              <Grid Background='Transparent' Cursor='SizeNWSE'>
                <Path Fill='#FFDDF0FF' Margin='0 0 2 2' VerticalAlignment='{TemplateBinding VerticalAlignment}' HorizontalAlignment='{TemplateBinding HorizontalAlignment}' Data='M0,4 L2,4 L 2,6 L 0,6 Z M4,0 L6,0 L6,2 L4,2 Z  M4,4 L6,4 L6,6 L4,6 Z'/>
                <Path Fill='#FF7F7F7F' Margin='0 0 3 3' VerticalAlignment='{TemplateBinding VerticalAlignment}' HorizontalAlignment='{TemplateBinding HorizontalAlignment}' Data='M0,4 L2,4 L 2,6 L 0,6 Z M4,0 L6,0 L6,2 L4,2 Z  M4,4 L6,4 L6,6 L4,6 Z'/>
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </MultiTrigger>
    </Style.Triggers>

  </Style>
  <Style TargetType='{x:Type Thumb}' x:Key='moveThumb'>
    <Setter Property='Cursor' Value='SizeAll'/>
    <Setter Property='Template'>
      <Setter.Value>
        <ControlTemplate TargetType='{x:Type Thumb}'>
          <Grid Background='{x:Null}' Cursor='{TemplateBinding Cursor}' HorizontalAlignment='{TemplateBinding HorizontalAlignment}' VerticalAlignment='{TemplateBinding VerticalAlignment}'>
            <Border Margin = '5' BorderBrush="#FFA8B7B8" Background='{x:Null}' Cursor='SizeAll' CornerRadius='0' BorderThickness='1'/>
            <Border Margin = '0' Cursor='SizeAll' CornerRadius='5' BorderThickness='5'>
              <Border.BorderBrush>
                <LinearGradientBrush StartPoint='0,0' EndPoint='1,0' Opacity='0.15'>
                  <GradientStop Color ='Turquoise' Offset ='0'/>
                  <GradientStop Color ='White' Offset ='0.5'/>
                  <GradientStop Color ='Turquoise' Offset ='1'/>
                </LinearGradientBrush>
              </Border.BorderBrush>
            </Border>
            <Path Fill="Turquoise" Opacity='0.15' Data='M0,0 L10,0 A 10,10 0 0 0 0,10 L0,0' Margin='6 6 0 0'/>
            <Path Fill="Turquoise" Opacity='0.15' Data='M0,0 L7,0 L 7 7 A 7,7 0 0 0 0,0 L0,0' Margin='0 6 6 0' HorizontalAlignment='Right'/>
            <Path Fill="Turquoise" Opacity='0.15' Data='M0,0 L0,7 L 7,7 A 7,7 90 0 1 0,0 L0,0' Margin='6 0 0 6' VerticalAlignment='Bottom'/>
            <Path Fill="Turquoise" Opacity='0.15' Data='M0,7 L7,7 L 7,0 A 7,7 0 0 1 0,7' Margin='0 0 6 6' HorizontalAlignment='Right' VerticalAlignment='Bottom'/>
            <Border Margin = '0' BorderBrush="#FFD4DDDE" Cursor='SizeAll' CornerRadius='5' BorderThickness='1'/>
            <Border Margin = '6'  BorderBrush="#FFDDDFE0" Background='{x:Null}' Cursor='SizeAll' CornerRadius='8' BorderThickness='1'/>
          </Grid>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>
  <ControlTemplate TargetType='ContentControl' x:Key='resizeBorder'>
    <Grid HorizontalAlignment='Stretch' VerticalAlignment='Stretch' Margin='-5'>
      <Grid.ContextMenu>
        <ContextMenu>
          <MenuItem Header='Bring to front'>
            <MenuItem Command ='{x:Static ssui:SpreadsheetCommands.BringToFront}' oui:RibbonElement.ControlState="Medium" CommandParameter="{Binding}"/>
            <MenuItem Command ='{x:Static ssui:SpreadsheetCommands.BringForward}' oui:RibbonElement.ControlState="Medium" CommandParameter="{Binding}"/>
          </MenuItem>
          <MenuItem Header='Send to back'>
            <MenuItem Command ='{x:Static ssui:SpreadsheetCommands.SendToBack}' oui:RibbonElement.ControlState="Medium" CommandParameter="{Binding}"/>
            <MenuItem Command ='{x:Static ssui:SpreadsheetCommands.SendBackward}' oui:RibbonElement.ControlState="Medium" CommandParameter="{Binding}"/>
          </MenuItem>
        </ContextMenu>
      </Grid.ContextMenu>
      <Thumb HorizontalAlignment='Stretch' VerticalAlignment='Stretch' Style='{StaticResource moveThumb}'/>
      <Thumb HorizontalAlignment='Left' VerticalAlignment='Top' Style='{StaticResource resizeThumb}'/>
      <Thumb HorizontalAlignment='Right' VerticalAlignment='Top' Style='{StaticResource resizeThumb}'/>
      <Thumb HorizontalAlignment='Left' VerticalAlignment='Bottom' Style='{StaticResource resizeThumb}'/>
      <Thumb HorizontalAlignment='Right' VerticalAlignment='Bottom' Style='{StaticResource resizeThumb}'/>
      <Thumb HorizontalAlignment='Center' VerticalAlignment='Top' Style='{StaticResource resizeThumb}'/>
      <Thumb HorizontalAlignment='Center' VerticalAlignment='Bottom' Style='{StaticResource resizeThumb}'/>
      <Thumb HorizontalAlignment='Left' VerticalAlignment='Center' Style='{StaticResource resizeThumb}'/>
      <Thumb HorizontalAlignment='Right' VerticalAlignment='Center' Style='{StaticResource resizeThumb}'/>
    </Grid>
  </ControlTemplate>

</ResourceDictionary>